;; Test if expressions
(display "===== Testing Conditional and Logical Operations =====")
(newline)
(newline)

;; Test basic if expressions
(display "1. Basic if expressions:")
(newline)
(display "(if (> 5 3) \"5 is greater than 3\" \"5 is not greater than 3\") => ")
(display (if (> 5 3) "5 is greater than 3" "5 is not greater than 3"))
(newline)
(display "(if (< 5 3) \"5 is less than 3\" \"5 is not less than 3\") => ")
(display (if (< 5 3) "5 is less than 3" "5 is not less than 3"))
(newline)
(display "(if (= 5 5) \"5 equals 5\" \"5 does not equal 5\") => ")
(display (if (= 5 5) "5 equals 5" "5 does not equal 5"))
(newline)
(display "Nested if: ")
(display (if (> 10 10) "10 is greater than 10" (if (= 10 10) "10 equals 10" "10 is less than 10")))
(newline)
(newline)

;; Test if with no alternative
(display "2. If with no alternative:")
(newline)
(display "(if 1 \"This should be true\") => ")
(display (if 1 "This should be true"))
(newline)
(display "(if () \"This should not be displayed\") => ")
(display (if () "This should not be displayed"))
(newline)
(newline)

;; Test cond expressions
(display "3. Cond expressions:")
(newline)
(display "(cond ((> 5 10) \"5>10\") ((< 5 10) \"5<10\") (else \"5=10\")) => ")
(display (cond ((> 5 10) "5>10") ((< 5 10) "5<10") (else "5=10")))
(newline)
(display "(cond ((> 10 5) \"10>5\") ((< 10 5) \"10<5\")) => ")
(display (cond ((> 10 5) "10>5") ((< 10 5) "10<5")))
(newline)
(display "(cond ((= 5 10) \"5=10\") (else \"5≠10\")) => ")
(display (cond ((= 5 10) "5=10") (else "5≠10")))
(newline)
(newline)

;; Test comparison operators
(display "4. Comparison operators:")
(newline)
(display "(> 5 3) => ")
(display (> 5 3))
(newline)
(display "(< 3 5) => ")
(display (< 3 5))
(newline)
(display "(= 5 5) => ")
(display (= 5 5))
(newline)
(display ">(>= 5 5) => ")
(display (>= 5 5))
(newline)
(display "(<= 3 5) => ")
(display (<= 3 5))
(newline)
(display "(> 1 2 3) => ")
(display (> 1 2 3))
(newline)
(display "(> 3 2 1) => ")
(display (> 3 2 1))
(newline)
(display "(< 1 2 3) => ")
(display (< 1 2 3))
(newline)
(display "(<= 1 2 2) => ")
(display (<= 1 2 2))
(newline)
(display "(= 5 5 5) => ")
(display (= 5 5 5))
(newline)
(newline)

;; Test logical operators
(display "5. Logical operators:")
(newline)
(display "(and 1 1) => ")
(display (and 1 1))
(newline)
(display "(and 1 ()) => ")
(display (and 1 ()))
(newline)
(display "(and () 1) => ")
(display (and () 1))
(newline)
(display "(and () ()) => ")
(display (and () ()))
(newline)
(display "(and (> 5 3) (< 3 5)) => ")
(display (and (> 5 3) (< 3 5)))
(newline)
(display "(and (> 5 3) (> 3 5)) => ")
(display (and (> 5 3) (> 3 5)))
(newline)
(display "(and) => ")
(display (and))
(newline)
(display "(or 1 1) => ")
(display (or 1 1))
(newline)
(display "(or 1 ()) => ")
(display (or 1 ()))
(newline)
(display "(or () 1) => ")
(display (or () 1))
(newline)
(display "(or () ()) => ")
(display (or () ()))
(newline)
(display "(or (> 5 3) (> 3 5)) => ")
(display (or (> 5 3) (> 3 5)))
(newline)
(display "(or (> 5 10) (> 10 15)) => ")
(display (or (> 5 10) (> 10 15)))
(newline)
(display "(or) => ")
(display (or))
(newline)
(display "(not 1) => ")
(display (not 1))
(newline)
(display "(not ()) => ")
(display (not ()))
(newline)
(display "(not (> 5 3)) => ")
(display (not (> 5 3)))
(newline)
(display "(not (< 5 3)) => ")
(display (not (< 5 3)))
(newline)
(newline)

;; Test complex expressions
(display "6. Complex expressions:")
(newline)
(display "if with and: ")
(display (if (and (> 5 3) (< 3 10))
    "5 is between 3 and 10"
    "5 is not between 3 and 10"))
(newline)
(display "if with or: ")
(display (if (or (< 5 3) (> 5 10))
    "5 is either less than 3 or greater than 10"
    "5 is between 3 and 10"))
(newline)
(display "complex cond: ")
(display (cond ((and (> 0 15) (< 15 10)) "15 is between 0 and 10")
      ((and (>= 15 10) (<= 15 20)) "15 is between 10 and 20")
      (else "15 is outside the range")))
(newline)
(newline)

;; Test with variables and define
(display "7. Tests with variables:")
(newline)
(define a 5)
(define b 10)
(display "a = 5, b = 10: ")
(if (> a b) (display "a is greater than b") (display "a is less than or equal to b"))
(newline)

;; Test nested conditionals
(define x 15)
(display "x = 15: ")
(display (cond ((> x 20) "x is greater than 20")
      ((> x 10) 
       (cond ((> x 15) "x is greater than 15")
             ((= x 15) "x equals 15")
             (else "x is between 10 and 15")))
      (else "x is less than or equal to 10")))
(newline)

;; Test with let expressions
(display "let ((x 7) (y 3)): ")
(display (let ((x 7) (y 3))
  (cond ((> x y) "x is greater than y")
        ((< x y) "x is less than y")
        (else "x equals y"))))
(newline)

;; Test equality with different types
(display "(= \"hello\" \"hello\") => ")
(display (= "hello" "hello"))
(newline)
(display "(= \"hello\" \"world\") => ")
(display (= "hello" "world"))
(newline)
(newline)

(display "===== Tests Completed =====")
(newline)